package by.yativem.commons.console;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;



public class ConsoleCommandBean implements Serializable{	
	
	private static final long serialVersionUID = 1L;
	
		String commandName;
		Map<String, String> params = new HashMap<String, String>();
		
		public ConsoleCommandBean(String commandName ){
			this.commandName = commandName;
		}
		
		public ConsoleCommandBean(){
			
		}
	
		public String getCommandName() {
			return commandName;
		}

		public void setCommandName(String commandName) {
			this.commandName = commandName;
		}

		public boolean isExistParams() {
			return params.isEmpty();
		}

		public boolean containsKey(String key) {
			return params.containsKey(key);
		}

		public boolean containsValue(String value) {
			return params.containsValue(value);
		}

		public String getParam(String key) {
			return params.get(key);
		}
		
		

		public String setParam(String key, String value) {
			return params.put(key, value);
		}

		public void putAll(Map<? extends String, ? extends String> m) {
			params.putAll(m);
		}

		public void setParams(Map<String, String> params) {
			this.params = params;
		}	
		
		public Map<String, String> getParams(){
			return params;
		}
		
		@Override
		public String toString(){
			StringBuilder sb = new StringBuilder("[commandName :" ).append(this.commandName).append("] props :");
			for(String key : params.keySet()){
				
			sb.append("[").append(key).append(" : ").append(params.get(key)).append("] ");
			
			}
			
			
			return sb.toString();
		}
		
		
}
